﻿using System.Threading;
using NoRefsTest.Client.MySvc;

namespace NoRefsTest.Client
{
	public static class ProxyHelper
	{
		private static MyServiceClient _proxy;
		private static readonly object _lockObj = new object();

		public static MyServiceClient Proxy
		{
			get
			{
				if (ViewModelBase.IsDesignMode) return null;
				if (_proxy == null)
				{
					lock (_lockObj)
					{
						Thread.MemoryBarrier();
						if (_proxy == null)
						{
							_proxy = new MyServiceClient();
						}
					}
				}
				return _proxy;
			}
		}
	}
}